package com.spirit.dao.userdao;

import com.spirit.domain.user.Aderess;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

@Repository
public class AderessDao {
    private static Map<Integer, Aderess> aderessMap;
    private static int aderessId = 0;

    static {
        aderessMap = new HashMap<Integer, Aderess>();
        aderessId = ++ aderessId;
        aderessMap.put(aderessId, new Aderess("五龙口街","太原",
                "山西",aderessId));
        aderessId = ++ aderessId;
        aderessMap.put(aderessId, new Aderess("长风街","太原",
                "山西",aderessId));
        aderessId = ++ aderessId;
        aderessMap.put(aderessId, new Aderess("学府街","太原",
                "山西",aderessId));
        aderessId = ++ aderessId;
        aderessMap.put(aderessId, new Aderess("南中环街","太原",
                "山西",aderessId));
    }

    public Aderess getAderess(Integer id) {
        return aderessMap.get(id);
    }

    public Collection<Aderess> listAderess() {
        return aderessMap.values();
    }
}
